#include<bits/stdc++.h>
using namespace std;
constexpr int maxn = 1024;
constexpr int RANGE = 100000;
int arr[maxn];
int main() {
  srand(time(nullptr));
  for(int i=0; i<maxn; ++i) {
    // arr[i] = rand()%RANGE;
    arr[i] =  i*2;
  }

  sort(begin(arr), end(arr));

  int target;
  cout << "Please input your desired munber: ";
  cin >> target;
  int l=0, r=maxn;
  int m = (l+ r)/2;
  bool found = false;
  while(!found && l < r-1) {
    if(arr[m]==target) {
      cout << arr[m] << endl;
      found = true;
    } else if(arr[m]>target) {
      r = m;
      m = (l+r)/2;
    } else if(arr[m]<target) {
      l = m;
      m = (l+r)/2;
    }
  }


  if(found) {
    cout << target << " Found at " << m << endl;
  } else {
    cout << target << " Not Found" << endl;
  }


  cout << "Finished after " << (double)clock()/CLOCKS_PER_SEC << "s" << endl;
  return 0;
}
